Remove sync over async, convert APIs to async#9
Closed
kevingosse wants to merge 2 commits intobraintrustdata:mainfrom
Closed
Remove sync over async, convert APIs to async#9kevingosse wants to merge 2 commits intobraintrustdata:mainfrom
kevingosse wants to merge 2 commits intobraintrustdata:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR converts the Braintrust SDK from synchronous to asynchronous APIs, eliminating the sync-over-async anti-pattern and improving scalability. The changes include converting all API client methods to return Task<T>, updating the Eval framework to support async build and run operations, and migrating all tests and examples to use async/await patterns.
Changes:
- Converted
IBraintrustApiClientinterface andBraintrustApiClientimplementation to async methods, removing sync-over-async patterns - Refactored
Eval<TInput, TOutput>to use async initialization inBuildAsync()and async execution inRunAsync() - Extracted
ApiExceptionto a separate file and movedMockBraintrustApiClientto its own test file for better organization
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Braintrust.Sdk/Api/IBraintrustApiClient.cs | Converted all method signatures to return Task for async operations |
| src/Braintrust.Sdk/Api/BraintrustApiClient.cs | Removed sync-over-async anti-pattern, converted methods to proper async/await with ConfigureAwait(false) |
| src/Braintrust.Sdk/Api/ApiException.cs | Extracted ApiException class to separate file for better organization |
| src/Braintrust.Sdk/Eval/Eval.cs | Converted Build() to BuildAsync() and Run() to RunAsync(), moved async initialization from constructor to builder |
| src/Braintrust.Sdk/Braintrust.cs | Renamed ProjectUri() to GetProjectUriAsync() and converted to async |
| tests/Braintrust.Sdk.Tests/Eval/MockBraintrustApiClient.cs | Extracted mock client to separate file, converted to async methods |
| tests/Braintrust.Sdk.Tests/Eval/EvalTest.cs | Updated tests to async, removed mock client definition |
| tests/Braintrust.Sdk.Tests/Api/BraintrustApiClientTest.cs | Converted all test methods to async with proper async assertions |
| examples/SimpleOpenTelemetry/Program.cs | Updated Main to async and converted GetProjectUriAsync() call |
| examples/OpenAIInstrumentation/Program.cs | Updated GetProjectUriAsync() call |
| examples/EvalExample/Program.cs | Updated Main to async and converted BuildAsync()/RunAsync() calls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
Closed in favor of #10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.